package com.kfm.hotel.controller;

import com.kfm.hotel.domain.Guests;
import com.kfm.hotel.service.GuestsService;
import com.kfm.hotel.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/guests")
@Slf4j
public class GuestsController {

    @Autowired
    private GuestsService service;

    @PostMapping
    public R saveBatch(@RequestBody List<Guests> guestsList){
        log.info("guestsList: {}", guestsList);
        service.saveBatch(guestsList);
        return R.ok("保存成功");
    }
}
